<?php

	class DataSourceModel extends EbTableSQLModel
	{
		public function __construct()
		{		
			parent::init('eb_datasource','Core/DataSourceVO','da_id');
		}
		
		public function getColumns()
		{
			return array(
				new EbTableColumn('da_id','int',EB_PRIMARY_KEY,true),
				new EbTableColumn('name','varchar(32)'),
				new EbTableColumn('type','varchar(16)'),
				new EbTableColumn('connectionstring','varchar(256)')
			);
		}
				
		/**
		* Get the list of all data sources in the DB
		* - Append the default data source
		*/
		public function select($whereClause = null)
		{		
			$list = parent::select();
			
			$defaultDS =  parent::getVO();
			
			$defaultDS->name = "default";
			$defaultDS->type = "mysql";
			$defaultDS->da_id = 0;
			$defaultDS->connectionstring = "";
			
			array_unshift ($list,$defaultDS);
			
			return $list;
		}
	}